Add Neovim floating chat input (:Augment chat-input)#66
Conversation
Add a new range-aware :Augment chat-input subcommand that opens a centered floating window with a markdown scratch buffer for composing a chat message. Submitting joins the buffer lines, closes the float, restores the prior mode (re-selecting a visual range via gv so the selection is passed through), and dispatches to the existing chat flow. The floating window is Neovim-only (nvim_open_win). In Vim, the command falls back to the standard input() prompt used by :Augment chat, with no change to existing behavior. No third-party dependencies and no default mappings are added. Buffer-local mappings: <C-s> (insert/normal) and <CR> (normal) submit; <Esc> (normal) and <C-c> (insert/normal) cancel. Update the command completion list, README.md, doc/augment.txt, and CHANGELOG.md.
|
👋 I've got this PR — here's what I'll handle for you:
Marking it ready and picking reviewers are your call — I'll leave both alone. Drop a comment anytime! Note: opened under @mgmonteleone's identity — the org bot lacks PR write access on this repo, so attribution may differ from other automated PRs. |
|
✅ Ready for review on
Reviewer pick is your call — I won't request anyone myself. I'll respond to any review feedback as it comes in (no merge — that stays a human gate). |
|
Minor UX thought: if the user switches out of the float (e.g. |
|
Good call on the orphaned-float UX. Implemented in Updated the README and |
…hat-input # Conflicts: # CHANGELOG.md
|
Resolved the merge conflict with Re-ran the headless Neovim smoke test → |
|
Found during manual QA (CSS-902): whitespace guard misses pure-newline messages. Repro: Cause: the guard in if a:message ==# '' || a:message =~# '^\s*$'Fix: swap if a:message ==# '' || a:message =~# '^\_s*$'The empty-string check is then redundant but harmless. Worth a sub-case in the smoke test (buffer = |
|
Found during manual QA (CSS-902): visual selection is not restored after submit, contrary to PR description. Repro: open any file, Cause: let was_visual = index(['v', 'V', "\<C-v>"], mode()) >= 0 " always false here
...
let Callback = function('s:ChatInputSubmit', [source_win, ranged, was_visual])Fix: drive reselect off let Callback = function('s:ChatInputSubmit', [source_win, ranged, ranged])(Or simpler: drop the dead Worth a smoke-test sub-case: invoke from visual-line mode, submit, assert |
Address review feedback (CSS-902): - Use \_s instead of \s in the empty-message guard (s:ChatInputSubmit and s:CommandChat) so a buffer of only newlines/blank lines is treated as cancel rather than sending an empty chat message. - Drive visual reselection off a:ranged instead of the always-false was_visual (mode() is already 'n' by the time the command runs), so the '<,'> selection is restored via gv on submit as documented. Extended the headless smoke test with an empty-guard sub-case and a gv reselection sub-case.
|
Thanks for the QA finds (CSS-902) — both fixed in
Extended the headless smoke test with an empty-guard sub-case (blank/newline-only → cancel) and a |
|
Re-tested on
Rest of the matrix from the previous run was already green. No new issues. 👍 |
|
@mgmonteleone Ready to merge on
Holding for the human merge gate — I won't merge automatically. |
johnny2211
left a comment
There was a problem hiding this comment.
Re-approving on 629bb0f after CSS-902 fixes verified (Cases 4 and 5 now PASS). Full QA matrix green. ✅
Closes #61.
What
Adds a new range-aware
:Augment chat-inputsubcommand that opens a centered floating window with a markdown scratch buffer for composing a chat message before sending it. This upstreams a dependency-free, Neovim-gated version of the floating input the issue author shared (their LazyVim gist), reusing the existing chat plumbing.Behavior
nvim_open_winwith a scratch buffer (buftype=nofile,bufhidden=wipe), markdown filetype, opened in insert mode.<C-s>(insert/normal) or<CR>(normal) joins the buffer lines, closes the float, and dispatches to the existing chat flow.<Esc>(normal) or<C-c>(insert/normal) closes the float without sending.:Augment chat, invoking from visual mode (or with a range) includes the selected text. On submit the prior visual selection is restored viagvso it is passed through to the chat request.input()prompt used by:Augment chat, with no change to existing behavior.Changes
autoload/augment.vim—s:CommandChatInputhandler +s:ChatInputSubmitcallback; wired into command dispatch and completion.autoload/augment/chat.vim—augment#chat#OpenInputWindowplus submit/cancel helpers and buffer-local mappings.README.md,doc/augment.txt,CHANGELOG.md— document the new command.Validation
nvim --headless): verifies the function and completion entry exist, the float opens with a markdown buffer, a multi-line submit invokes the callback with the joined message and closes the window, and cancel closes the window without firing the callback. Result:SMOKE_OK.Pull Request opened by Augment Code | View session